if __name__=="__main__":
	base = -1

	dest = open("token_str.c", "w")
	dest.write("static char *token_str[] = {\n")

	for line in open("../grammar.tab.h", "r"):
		if line.startswith("#define L"):
			define, str, code = line.split()
			if base == -1:
				base = code
			dest.write("\t\"" + str + "\",\n")
		
	dest.write("};\n")

	dest.write("static int token_str_base = " + base + ";\n")

